﻿var bShowHide = false;

function ShowReport(id) {
    var startDate = $get(g_str_txtStart).value;
    var endDate = $get(g_str_txtEnd).value;

    var wOpen;
    var sOptions;
    var aWinName = '_blank';
    var aURL = 'RptList.aspx?startDate=' + startDate + '&endDate=' + endDate + '&id=' + id;

    sOptions = 'toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1';
    sOptions = sOptions + ',width=' + (screen.availWidth - 10).toString();
    sOptions = sOptions + ',height=' + (screen.availHeight - 152).toString();
    sOptions = sOptions + ',screenX=0,screenY=0,left=0,top=0';
    wOpen = window.open('', aWinName, sOptions);
    wOpen.location = aURL;
}

function ShowHide(div, img) {
    var divContent = div;
    var img_down_right = img;
    
    if (bShowHide) {
        divContent.style.display = '';
        img_down_right.src = "../Images/Hipocrate/icon_down.gif";
        bShowHide = false;
    }
    else {
        divContent.style.display = 'none';
        img_down_right.src = "../Images/Hipocrate/icon_up.gif";
        bShowHide = true;
    }
}

function ShowHideDisplay(div, img) {
    var divContent = div;
    var img_down_right = img;

    if (bShowHide) {
        divContent.style.display = '';
        img_down_right.src = "../Images/Hipocrate/icon_down.gif";
        bShowHide = false;
    }
    else {
        divContent.style.display = 'none';
        img_down_right.src = "../Images/Hipocrate/icon_up.gif";
        bShowHide = true;
    }
}

var intHide;
var intShow;

function animateX(i, j) {
    if (arguments.length) { this.getready(i, j); }
}

animateX.prototype.getready = function(i, j) {
    this.i = i;
    this.j = j;
    this.b = 0;
    this.speed = 5;
};

animateX.prototype.show = function(divPnlAnimation, divPnlContent) {
    if (this.i < this.j) {
        this.i = this.i + this.speed;
        $get(divPnlAnimation).style.height = this.i + "px";
    }
    else {
        $get(divPnlContent).style.display = '';
    }
};

animateX.prototype.hide = function(divPnlAnimation) {
    if (this.j > this.i) {
        this.j = this.j - this.speed;
        $get(divPnlAnimation).style.height = this.j + "px";
    }
};

var xObj = new animateX(20, 100);

function init(i, j, divPnlAnimation, divPnlContent) {
    this.b = 0;
    divPnlAnimation.style.width = i + "px";
    divPnlContent.style.height = j + "px";
}

function show_hide(divPnlAnimation, divPnlContent) {
    //alert(divPnlAnimation);
    //alert(divPnlContent);
    divPnlContent.style.display = '';
    //init(0, 20, divPnlAnimation, divPnlContent);
//    
//    if (xObj.b == 1) {
//        xObj.b = 0;
//        clearInterval(intHide);

//        intShow = setInterval("xObj.show(" + divPnlAnimation + "," + divPnlContent + ")", 10);
//        xObj.i = 20;
//        xObj.j = 100;
//    }
//    else {
//        xObj.b = 1;
//        clearInterval(intShow);

//        $get(divPnlContent).style.display = 'none';
//        intHide = setInterval("xObj.hide(" + divPnlAnimation + ")", 10);
//        xObj.i = 20;
//        xObj.j = 100;
//    }
}